package cn.com.surker.material.dao;

import cn.com.surker.dto.main.MainDiscountQueryDTO;
import cn.com.surker.material.entity.MainMaterialDiscount;
import cn.com.surker.vo.main.MainMaterialDiscountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 材料扣重设置表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-06-29
 */
public interface MainMaterialDiscountDao extends BaseMapper<MainMaterialDiscount> {

    /**
     * 分页查询云端扣重
     * @param page
     * @param dto
     * @return
     */
    IPage<MainMaterialDiscountVO> findCloudPage(Page<MainMaterialDiscount> page, String dbCode, String searchVal, Long orgId, Long supplierId, Long materialId);

    IPage<MainMaterialDiscountVO> page(Page<MainMaterialDiscount> page, @Param("dto") MainDiscountQueryDTO dto);


    List<Map<String,Object>> getSupplierNameBySupplierIdList(@Param("materialIdList") List<Long> materialIdList);

    Integer updateCloud(String dbCode, @Param("discount") MainMaterialDiscount discount);

    Integer saveCloud(String dbCode, @Param("dto") MainMaterialDiscount discount);

    MainMaterialDiscount findExistDiscount(String dbCode, Long orgId, Long supplierId, Long materialId);

}
